/**
 * @author gaopeng
 * @date 2019/12/17 10:22 下午
 */
public class Originator {
    private String state;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public IMemento createMemento(){
        return new Memento(this.state);
    }

    public void restoreMemeto(IMemento memento){
        this.state = ((Memento)memento).state;
    }


    private class Memento implements IMemento{
        private String state;

        public Memento(String state) {
            this.state = state;
        }
    }
}
